﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DownloadFile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!HttpContext.Current.User.Identity.IsAuthenticated)
        {
            Response.Redirect("~/Default.aspx");
        }
        LoadFiles();
    }

    private void LoadFiles()
    {

        IList<ItemRepeaterD> lista = new List<ItemRepeaterD>();
        DirectoryInfo directoryInfo = new DirectoryInfo(Server.MapPath(".") + "\\download");
        FileInfo[] fInf0 = directoryInfo.GetFiles();
        foreach (var info in fInf0)
        {
            TreeNode tn = new TreeNode(info.Name, "download/" + info.Name)
                              {NavigateUrl = "download/" + info.Name, Target ="_blank"};
            treeView1.Nodes.Add(tn);
        }
    }
    public class ItemRepeaterD
    {
        public string Nume { get; set; }
        public string Link { get; set; }
    }
}
